package com.fancy.common.utils;

import org.apache.commons.lang.StringUtils;

import com.fancy.common.exception.DataErrorException;

/**
 * URL静态资源公共类.
 * 
 * @author xinfeng.hu 2013-3-13下午12:15:34
 * @version 1.0.0
 * @category 杭州广桥网络技术有限公司(商业先知)
 */
public final class URIs {

	// 空间名
	//private static final String BUCKET_NAME = Config.getString("upyun.bucketName");
	// 空间域名
	//private static final String BUCKET_URL = "http://" + BUCKET_NAME + ".b0.upaiyun.com";

	public static String getServer() {
		return Config.getString("bizexpress.url");
	}

	public static String getImgServer() {
		return "http://statics.juyixian.com";
	}

	public static String renderURI(String prefixUrl, String path) {
		if (StringUtils.isBlank(prefixUrl) || StringUtils.isBlank(path)) {
			throw new DataErrorException();
		}
		if (path.startsWith("http")) {
			return path;
		}
		return (prefixUrl.endsWith("/") ? prefixUrl : prefixUrl + "/") + path;
	}

}
